import http from '../utils/http.js';
import apiApp from "./api-app.js"

let api = {}

//===================宝贝风采页面
//获取商品列表
api.goodsFindAllByList = (params) => http.get(`/app/goods/findAllByList`, null)
//添加订单
api.billAdd = (params) => http.post(`/app/bill/add`, params)
// api.userUpdInfo = (params) => http.post(`/app/user/editInfo`, params)


//添加已选择图片
api.pictureCheckAdd = (params) => http.post(`/app/picbill/add`, params)



//======================我的页面
//----我的宝贝,获取绑定的学生
api.studentFindAllByParentId = (parentId) => http.get(`/app/parent/findStuAllByParentId/${parentId}`)

//=========我的页面之 -----宝贝班级
//关联宝贝
api.parentStudentAdd = (params) => http.post(`/app/parent/parentStuAdd`, params)
//取消关联
api.parentStudentDel = (params) => http.post(`/app/parent/parentStuDel`, params)
//查询关联
api.parentStuFind = (params) => http.post(`/app/parent/parentStuFind`, params)

//==============我的页面-----------宝贝相册
//获取订单列表
api.billFindByParentId = parentId => http.get(`/app/bill/findAllByParentId/${parentId}`)
//获取订单购买图片
api.findPicByBillId = id => http.get(`/app/bill/findPicByBillId/${id}`)
//根据id查询商品信息 
api.goodsFindById = goodsId => http.get(`/app/goods/findById/${goodsId}`)

//用户登录
api.userLogin = (params) => http.post(`/app/login/mpWeixin`, params, {
	isLoginRequest: true
})
//用户手机号登录
api.userLoginPhone = (params) => http.post(`/app/login/mpWeixinPhone`, params, {
	isLoginRequest: true
})

//根据code查找幼儿园
api.kgFindByCode = kgCode => http.get(`/app/kg/findByCode/${kgCode}`)
//根据code查找教师
api.teacherFindByCode = teacherCode => http.get(`/app/teacher/findByCode/${teacherCode}`)
//教师登录后--更新教师信息（把获取的openid 头像等存入教师表中 对应的教师）
api.teacherInfoUpdate = (params) => http.post(`/app/teacher/update`, params)
//家长登录后存家长信息
api.parentInfoAdd = (params) => http.post(`/app/parent/add`, params)
//根据 vxid 查找教师
api.findTeacherByVxId = vxId => http.get(`/app/teacher/findByVxId/${vxId}`)
//根据 vxid 查找家长
api.findParentByVxId = vxId => http.get(`/app/parent/findByVxId/${vxId}`)

//上传文件
// {
// 	file:file,
// 	rootPath:rootPath
// }
api.upFile = (params) => http.uploadFile(`/app/file/up`, params)
//添加学生图片
api.addStuPic = (params) => http.post(`/app/picture/add`, params)

//多文件上传
api.upFiles = (params) => http.uploadFile(`/app/file/ups`, params)
//获取用户信息
api.userFindUserInfo = () => http.get(`/app/user/findUserInfo`)




//修改手机号
api.userUpdPhone = (params) => http.post(`/app/user/editPhone`, params)
//修改用户资料
api.userUpdInfo = (params) => http.post(`/app/user/editInfo`, params)

//根据教师id 查询班级列表
api.findClassListByTeacherId = teacherId => http.get(`/app/teacher/findClassListByTeacherId/${teacherId}`)
//查询班级列表
api.classFindList = kgId => http.get(`/app/class/findClassListByKgId/${kgId}`)
//根据班级id查询班级名称
api.findClassNameById = (params) => http.get(`/app/class/findById/${id}`, params)
//修改班级名称
api.editClass = (params) => http.post(`/app/class/edit`, params)
//根据班级id获取学生列表
api.appStudentFindByClassId = classId => http.get(`/app/student/findAllByClassId/${classId}`)
//根据学生id获取学生信息
api.appFindStudentById = id => http.get(`/app/student/findStudentById/${id}`)

//编辑学生信息
api.studentEdit = (params) => http.post(`/app/student/edit`, params)


//根据学生id获取学生图片
api.appPictureFindByStudentId = studentId => http.get(`/app/picture/findByStudentId/${studentId}`)
//获取已选的电子图片列表
api.appBillPicFindList = (studentId,parentId) => http.get(`/app/picbill/appBillPicFindList?studentId=`+studentId+`&parentId=`+parentId)
//获取已入册的照片
api.appBillPicPutFindList = (studentId,parentId) => http.get(`/app/picbill/appBillPicPutFindList?studentId=`+studentId+`&parentId=`+parentId)
//判断是否全部解锁
api.isUnlockAllPic = (studentId,parentId) => http.get(`/app/bill/BillFindByType?studentId=`+studentId+`&parentId=`+parentId)



//通知
//通知-所有通知
api.tongzhiFindAllByPage = (params) => http.get(`/app/tongzhi/findAllByPage`, params)

//添加反馈内容
api.appFeedBackAdd = (params) => http.post(`/app/feedback/add`, params)

//配置
//配置-协议
api.configXieyi = () => http.get(`/app/config/findByType/USER_XIEYI`)
//配置-隐私
api.configYinsi = () => http.get(`/app/config/findByType/USER_YINSI`)
//配置-关于我们
api.configAboutMe = () => http.get(`/app/config/findByType/ABOUT_ME`)

//添加api-tmpl
Object.assign(api, apiApp)

export default api;